
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<#assign base=request.contextPath  />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="${base}/assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="${base}/assets/css/font-awesome.min.css" />
		<!--[if IE 7]>
		  <link rel="stylesheet" href="${base}/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
		<link rel="stylesheet" href="${base}/assets/css/ace.min.css" />
		<link rel="stylesheet" href="${base}/assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="${base}/assets/css/ace-skins.min.css" />
        <link rel="stylesheet" href="${base}/css/style.css"/>
		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="${base}/assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="${base}/assets/js/ace-extra.min.js"></script>
		<!--[if lt IE 9]>
		<script src="${base}/assets/js/html5shiv.js"></script>
		<script src="${base}/assets/js/respond.min.js"></script>
		<![endif]-->
		<script src="${base}/js/jquery-1.9.1.min.js"></script>
        <script src="${base}/assets/layer/layer.js" type="text/javascript"></script>
<title>登录</title>
</head>
<script>
	//控制跳出ifream框架
    if (window != top)
        top.location.href = location.href;
</script>
<body class="login-layout Reg_log_style">
<div id="key">
<div class="logintop">    
    <span>欢迎后台管理界面平台</span>    
    <ul>
    <li><a href="#">返回首页</a></li>
    <li><a href="#">帮助</a></li>
    <li><a href="#">关于</a></li>
    </ul>    
    </div>
    <div class="loginbody">
<div class="login-container">
	<div class="center">
	     <small>					
						<img src="${base}/img/logos.png" width="470px">
						</small>
							</div>

							<div class="space-6"></div>

							<div class="position-relative">
								<div id="login-box" class="login-box widget-box no-border visible">
									<div class="widget-body">
										<div class="widget-main">
											<h4 class="header blue lighter bigger">
												<i class="icon-coffee green"></i>
												<font style="font-family: microsoft yahei">Welcome!</font>
                                                <font id="msg"style="color: red"></font>
											</h4>

											<div class="login_icon"><img src="${base}/img/logos2.jpg"   width="140px">
					</div>

											<form class="">
												<fieldset>
										<ul>
   <li class="frame_style form_error"><label class="user_icon"></label><input name="用户名" type="text"  id="username"/></li>
   <li class="frame_style form_error"><label class="password_icon"></label><input name="密码" type="password"   id="userpwd"/></li>

   
  </ul>
													<div class="space"></div>

													<div class="clearfix">
														<label class="inline">
															<input type="checkbox" id="SavePass" class="ace">
															<span class="lbl">保存密码</span>
														</label>

														<button type="button" class="width-35 pull-right btn btn-sm btn-primary" id="login_btn">
															<i class="icon-key"></i>
															登录
														</button>
													</div>

													<div class="space-4"></div>
												</fieldset>
											</form>

											<div class="social-or-login center">
												<span class="bigger-110">通知</span>
											</div>

											<div class="social-login center">
											本网站系统不再对IE8以下浏览器支持，请见谅。
											</div>
										</div><!-- /widget-main -->

										<div class="toolbar clearfix">
											

											
										</div>
									</div><!-- /widget-body -->
								</div><!-- /login-box -->
							</div><!-- /position-relative -->
						</div>
                        </div>
                        <div class="loginbm">版权所有  2018  <a href="">齐鑫科技有限公司</a> </div><strong></strong>
</div>
</body>
</html>
<script>
    getUser();
	//键盘事件
    $("body").bind("keydown",function(e){
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
        if (code == 13) {
            //回车执行查询
            $("#login_btn").click();
        }
    });
$('#login_btn').on('click', function(){

    $.ajax({
        type : "POST", //提交方式
        url : "${base}/user/login",//路径
        data :{username:$("#username").val(),password:$("#userpwd").val()},
        success : function(data) {//返回数据根据结果进行相应的处理
            if ($("#SavePass").is(':checked')){
                setCookie("username",$("#username").val(),14);
                setCookie("password",$("#userpwd").val(),14);
            }
			var result=JSON.parse(data);
			if (result.flag){
                window.location.href="${base}/user/index";
			}else{
				$("#msg").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
                        result.msg
				);
			}

        }
    });
		
	});

function getUser(){
	$("#username").val(getCookie("username"));
	$("#userpwd").val(getCookie("password"));
}
    function getCookie(c_name)
    {
        if (document.cookie.length>0)
        {
            c_start=document.cookie.indexOf(c_name + "=")
            if (c_start!=-1)
            {
                c_start=c_start + c_name.length+1
                c_end=document.cookie.indexOf(";",c_start)
                if (c_end==-1) c_end=document.cookie.length
                return unescape(document.cookie.substring(c_start,c_end))
            }
        }
        return ""
    }
    function setCookie(c_name,value,expiredays)
    {
        var exdate=new Date()
        exdate.setDate(exdate.getDate()+expiredays)
        document.cookie=c_name+ "=" +escape(value)+
                ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
    }
  $(document).ready(function(){
	 $("input[type='text'],input[type='password']").blur(function(){
        var $el = $(this);
        var $parent = $el.parent();
        $parent.attr('class','frame_style').removeClass(' form_error');
        if($el.val()==''){
            $parent.attr('class','frame_style').addClass(' form_error');
        }
    });
	$("input[type='text'],input[type='password']").focus(function(){		
		var $el = $(this);
        var $parent = $el.parent();
        $parent.attr('class','frame_style').removeClass(' form_errors');
        if($el.val()==''){
            $parent.attr('class','frame_style').addClass(' form_errors');
        } else{
			 $parent.attr('class','frame_style').removeClass(' form_errors');
		}
		});
	  })

</script>